package reflect;

import reflect.annotations.AutoRunClass;

import java.io.File;

public class Test4 {
    public static void main(String[] args)throws Exception {
        File dir = new File(
                Test4.class.getResource(".").toURI()
        );
        String packageName = Test4.class.getPackage().getName();
        System.out.println(packageName);
        File[] files = dir.listFiles(f -> f.getName().endsWith(".class"));
        for (File file : files) {
            String s = file.getName().substring(0, file.getName().indexOf("."));
            Class<?> cls = Class.forName(packageName + "." + s);
            if (cls.isAnnotationPresent(AutoRunClass.class)){
                System.out.println(s);
            }
        }



    }
}
